﻿Module DESIGNAPP
    Dim ChkColorTable As Boolean = False

    Public Sub DesignGrid(ByRef GridName As DevComponents.DotNetBar.SuperGrid.SuperGridControl)
        GridName.DefaultVisualStyles.GridPanelStyle.Background.Color1 = Color.AliceBlue
        GridName.DefaultVisualStyles.GridPanelStyle.Background.Color2 = SystemColors.GradientInactiveCaption
        GridName.DefaultVisualStyles.CellStyles.SelectedMouseOver.Background.Color1 = Color.Gold
        GridName.DefaultVisualStyles.CellStyles.SelectedMouseOver.Background.Color2 = Color.LemonChiffon
        GridName.DefaultVisualStyles.CellStyles.Selected.Background.Color1 = Color.Khaki
        GridName.DefaultVisualStyles.CellStyles.Selected.Background.Color2 = Color.LemonChiffon
        GridName.DefaultVisualStyles.GridPanelStyle.HorizontalLineColor = SystemColors.ActiveCaption
        For i = 0 To GridName.PrimaryGrid.Columns.Count - 1
            If GridName.PrimaryGrid.Columns(i).ReadOnly Then
                GridName.PrimaryGrid.Columns(i).CellStyles.Default.Background.Color1 = Color.FromArgb(205, 228, 252)
                GridName.PrimaryGrid.Columns(i).CellStyles.Default.Background.Color2 = Color.FromArgb(205, 228, 252)
            Else
                GridName.PrimaryGrid.Columns(i).CellStyles.Default.Background.Color1 = Color.White
                GridName.PrimaryGrid.Columns(i).CellStyles.Default.Background.Color2 = Color.White
            End If
            GridName.PrimaryGrid.Columns(i).CellStyles.Default.Font = New Font("Tahoma", 9.75, FontStyle.Regular)
            GridName.PrimaryGrid.Columns(i).HeaderStyles.Default.Font = New Font("Tahoma", 9.75, FontStyle.Regular)
        Next
    End Sub

    Public Sub DesignGrid(ByRef GridName As DevComponents.DotNetBar.Controls.DataGridViewX)
        GridName.BackgroundColor = SystemColors.GradientInactiveCaption
        GridName.DefaultCellStyle.SelectionBackColor = Color.LemonChiffon
        For i = 0 To GridName.Columns.Count - 1
            If GridName.Columns(i).ReadOnly Or GridName.ReadOnly Then
                GridName.Columns(i).DefaultCellStyle.BackColor = Color.FromArgb(220, 232, 244)
            Else
                GridName.Columns(i).DefaultCellStyle.BackColor = Color.White
            End If
            GridName.Columns(i).DefaultCellStyle.Font = New Font("Tahoma", 9.75, FontStyle.Regular)
            GridName.Columns(i).HeaderCell.Style.Font = New Font("Tahoma", 9.75, FontStyle.Regular)
        Next
        AddHandler GridName.DataSourceChanged, AddressOf GridName_DataSourceChanged
    End Sub

    Private Sub GridName_DataSourceChanged(sender As Object, e As EventArgs)
        Dim GridName As DevComponents.DotNetBar.Controls.DataGridViewX = CType(sender, DevComponents.DotNetBar.Controls.DataGridViewX)
        For i = 0 To GridName.Columns.Count - 1
            If GridName.Columns(i).ReadOnly Or GridName.ReadOnly Then
                GridName.Columns(i).DefaultCellStyle.BackColor = Color.FromArgb(220, 232, 244)
            Else
                GridName.Columns(i).DefaultCellStyle.BackColor = Color.White
            End If
            GridName.Columns(i).DefaultCellStyle.Font = New Font("Tahoma", 9.75, FontStyle.Regular)
            GridName.Columns(i).HeaderCell.Style.Font = New Font("Tahoma", 9.75, FontStyle.Regular)
        Next
    End Sub

    Public Sub DesignGrid(ByRef GridName As DataGridView)
        GridName.BackgroundColor = SystemColors.GradientInactiveCaption
        GridName.DefaultCellStyle.SelectionBackColor = Color.LemonChiffon
        For i = 0 To GridName.Columns.Count - 1
            If GridName.Columns(i).ReadOnly Or GridName.ReadOnly Then
                GridName.Columns(i).DefaultCellStyle.BackColor = Color.FromArgb(220, 232, 244)
            Else
                GridName.Columns(i).DefaultCellStyle.BackColor = Color.White
            End If
            GridName.Columns(i).DefaultCellStyle.Font = New Font("Tahoma", 9.75, FontStyle.Regular)
            GridName.Columns(i).HeaderCell.Style.Font = New Font("Tahoma", 9.75, FontStyle.Regular)
        Next
        AddHandler GridName.DataSourceChanged, AddressOf GridName_DataSourceChanged
    End Sub

    Public Sub DesignGridnonSetFont(ByRef GridName As DevComponents.DotNetBar.SuperGrid.SuperGridControl)
        GridName.DefaultVisualStyles.GridPanelStyle.Background.Color1 = Color.AliceBlue
        GridName.DefaultVisualStyles.GridPanelStyle.Background.Color2 = SystemColors.GradientInactiveCaption
        GridName.DefaultVisualStyles.CellStyles.SelectedMouseOver.Background.Color1 = Color.Gold
        GridName.DefaultVisualStyles.CellStyles.SelectedMouseOver.Background.Color2 = Color.LemonChiffon
        GridName.DefaultVisualStyles.CellStyles.Selected.Background.Color1 = Color.Gold
        GridName.DefaultVisualStyles.CellStyles.Selected.Background.Color2 = Color.LemonChiffon
        For i = 0 To GridName.PrimaryGrid.Columns.Count - 1
            If GridName.PrimaryGrid.Columns(i).ReadOnly Then
                GridName.PrimaryGrid.Columns(i).CellStyles.Default.Background.Color1 = Color.FromArgb(205, 228, 252)
                GridName.PrimaryGrid.Columns(i).CellStyles.Default.Background.Color2 = Color.FromArgb(205, 228, 252)
            Else
                GridName.PrimaryGrid.Columns(i).CellStyles.Default.Background.Color1 = Color.White
                GridName.PrimaryGrid.Columns(i).CellStyles.Default.Background.Color2 = Color.White
            End If
        Next
    End Sub

    Public Sub DesignForm(ByRef FormName As DevComponents.DotNetBar.OfficeForm)
        FormName.BackColor = SystemColors.GradientInactiveCaption
        FormName.EnableGlass = False
        FormName.StartPosition = FormStartPosition.CenterScreen
    End Sub

    Public Sub DesignBar(ByRef LabelName As DevComponents.DotNetBar.LabelX)
        LabelName.BackgroundStyle.BackColor = Color.AliceBlue
        LabelName.BackgroundStyle.BackColor2 = SystemColors.GradientActiveCaption
    End Sub

    Public Sub DesignPanel(ByRef LabelPanel As DevComponents.DotNetBar.PanelEx)
        LabelPanel.Style.BackColor1.Color = Color.AliceBlue
        LabelPanel.Style.BackColor2.Color = SystemColors.GradientInactiveCaption
    End Sub

    Sub DesignButtonSub(ByRef btn As DevComponents.DotNetBar.ButtonX)

        If ChkColorTable = False Then
            ' Create custom color scheme for the button and register it globaly
            Dim table As DevComponents.DotNetBar.Rendering.Office2007ButtonItemColorTable = New DevComponents.DotNetBar.Rendering.Office2007ButtonItemColorTable()
            table.Name = "MyColorName" ' This is the color table name that we assigned to the CustomColorName property in designer

            ' Define standard colors when mouse is not over the button
            table.Default = New DevComponents.DotNetBar.Rendering.Office2007ButtonItemStateColorTable()
            table.Default.OuterBorder.Start = SystemColors.GradientActiveCaption
            table.Default.OuterBorder.End = SystemColors.ActiveCaption
            table.Default.TopBackground.Start = Color.AliceBlue
            table.Default.TopBackground.End = SystemColors.GradientActiveCaption
            table.Default.BottomBackground.Start = SystemColors.GradientActiveCaption
            table.Default.BottomBackground.End = Color.FromArgb(151, 209, 255)
            table.Default.BottomBackgroundHighlight.Start = System.Drawing.Color.AliceBlue
            table.Default.BottomBackgroundHighlight.End = System.Drawing.Color.Transparent
            table.Default.Text = System.Drawing.Color.Black

            ' Define colors when mouse is over the button
            table.MouseOver = New DevComponents.DotNetBar.Rendering.Office2007ButtonItemStateColorTable()
            table.MouseOver.OuterBorder.Start = Color.Gold
            table.MouseOver.OuterBorder.End = Color.Goldenrod
            table.MouseOver.TopBackground.Start = Color.LemonChiffon
            table.MouseOver.TopBackground.End = Color.Khaki
            table.MouseOver.BottomBackground.Start = Color.Khaki
            table.MouseOver.BottomBackground.End = Color.NavajoWhite
            table.MouseOver.BottomBackgroundHighlight.Start = Color.Gold
            table.MouseOver.BottomBackgroundHighlight.End = System.Drawing.Color.Transparent
            table.MouseOver.Text = System.Drawing.Color.Black

            ' Define colors when mouse is pressed
            table.Pressed = New DevComponents.DotNetBar.Rendering.Office2007ButtonItemStateColorTable()
            table.Pressed.OuterBorder.Start = System.Drawing.Color.Maroon
            table.Pressed.OuterBorder.End = System.Drawing.Color.Black
            table.Pressed.TopBackground.Start = System.Drawing.Color.Yellow
            table.Pressed.TopBackground.End = System.Drawing.Color.OrangeRed
            table.Pressed.BottomBackground.Start = System.Drawing.Color.OrangeRed
            table.Pressed.BottomBackground.End = System.Drawing.Color.DarkOrange
            table.Pressed.BottomBackgroundHighlight.Start = System.Drawing.Color.Yellow
            table.Pressed.BottomBackgroundHighlight.End = System.Drawing.Color.Transparent
            table.Pressed.Text = System.Drawing.Color.Maroon
            If TypeOf (DevComponents.DotNetBar.Rendering.GlobalManager.Renderer) Is DevComponents.DotNetBar.Rendering.Office2007Renderer Then
                Dim r As DevComponents.DotNetBar.Rendering.Office2007Renderer = CType(DevComponents.DotNetBar.Rendering.GlobalManager.Renderer, DevComponents.DotNetBar.Rendering.Office2007Renderer)
                r.ColorTable.ButtonItemColors.Add(table)
                ChkColorTable = True
            End If
        End If

        btn.CustomColorName = "MyColorName"

    End Sub

    Sub DesignButtonMain(ByRef btn As DevComponents.DotNetBar.ButtonX)
        btn.ColorTable = DevComponents.DotNetBar.eButtonColor.BlueWithBackground
    End Sub

End Module
